package xyf.p11.other.bit;

/**
 * ClassName: M0506_ConvertInteger
 * Description:
 * Author: xyf
 * Date: 9/8/22 8:38 PM
 * Version: 1.0
 **/
public class M0506_ConvertInteger
{
    public int convertInteger(int A, int B)
    {
        int tmp = A ^ B;
        int base = 1;
        int res = 0;

        for (int i = 0; i < 32; i++)
        {
            if ((base & tmp) != 0)
            {
                res++;
            }
            base *= 2;
        }
        return res;
    }
}